package com.yucc.girlimages.ad;

import android.content.Context;

import com.waps.AppConnect;
import com.waps.UpdatePointsNotifier;
import com.yucc.girlimages.Config;

public class WapsAd extends AdPlatformAdapter<AppConnect> implements UpdatePointsNotifier {
	private static WapsAd sInstance ;
	private static Object sLock = new Object() ;
	
	private WapsAd(Context context) {
		super();
		AppConnect.getInstance(Config.WAPS_ID,Config.WAPS_PID,context) ; 
	}
	
	public static final WapsAd getInstance(Context context) {
		synchronized (sLock) {
			if(sInstance == null) {
				sInstance = new WapsAd(context) ;
			}
		}
		return sInstance ;
	}

	@Override
	public AppConnect getAdInstance(Context context) {
		// TODO Auto-generated method stub
		return AppConnect.getInstance(context);
	}


	@Override
	public void showOffers(Context context) {
		getAdInstance(context).showOffers(context) ;
	}

	@Override
	public void free(Context context) {
		getAdInstance(context).finalize() ;
	}

	@Override
	public void spendPoints(Context context,float point) {
		getAdInstance(context).spendPoints((int)point, this) ;
	}

	@Override
	public void getPoints(Context context) {
		getAdInstance(context).getPoints(this) ;
	}

	@Override
	public void getUpdatePoints(String currenyName, int amount) {
		if(successCallBack != null) successCallBack.getPointSuccess(currenyName, amount) ;
	}

	@Override
	public void getUpdatePointsFailed(String error) {
		// TODO Auto-generated method stub
		if(failureCallBack != null) failureCallBack.getPointFailure(error) ;
	}

}
